package com.xuelang.pipeline.app.pipeline;

import com.xuelang.pipeline.client.common.constant.DictDTO;
import com.xuelang.pipeline.client.common.request.PageParam;
import com.xuelang.pipeline.client.common.result.PageRecord;
import com.xuelang.pipeline.client.pipeline.dto.DeploymentUnitDTO;
import com.xuelang.pipeline.client.pipeline.dto.DeploymentUnitQuery;

import java.util.List;

/**
 * <p>部署单服务接口</p>
 *
 * @author : yixin.lys
 * @date : 2024-06-25 17:49
 **/
public interface DeploymentUnitService {

    /**
     * 根据流水线编码分页获取部署单
     *
     * @param query
     * @return
     */
    PageRecord<DeploymentUnitDTO> page(PageParam<DeploymentUnitQuery> query);


    /**
     * 新增部署单
     *
     * @param deploymentUnit
     */
    void add(DeploymentUnitDTO deploymentUnit);


    /**
     * 更新部署单
     *
     * @param deploymentUnit
     */
    void update(DeploymentUnitDTO deploymentUnit);

    /**
     * 通过流水线实例编码查询部署单详情
     *
     * @param pipelineInstanceCode
     * @return
     */
    DeploymentUnitDTO queryByPipelineInstanceCode(String pipelineInstanceCode);

    /**
     * 根据id批量删除
     *
     * @param idList
     */
    void removeByIds(List<String> idList);

    /**
     * 根据流水线实例code批量删除
     *
     * @param codeList
     */
    void removeByCodes(List<String> codeList);

    /**
     * 继续部署
     *
     * @param id
     * @return
     */
    Boolean continueDeployment(String id);

    /**
     * 回滚
     *
     * @param id
     * @return
     */
    Boolean rollback(String id);

    /**
     * 部署单部署进度
     *
     * @return
     */
    List<DictDTO> deploymentProcessStatus();
}
